package com.rg1906.dao.Impl;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;

import com.rg1906.utils.DataSourceC3P0ThreadLocal;

public class DeleteStudentMessageDaoImpl {
	DataSource dataSource = DataSourceC3P0ThreadLocal.getDataSource();
	QueryRunner qr = new QueryRunner(dataSource);
	public int deleteStudent(String[] arr) throws SQLException {
		int ii =0;
		String sql="delete from t_student where studentNum=?";
		for (String i : arr) {
			 ii = qr.update(sql,i);
			 if(ii<1) {
				return 0;
			 }
		}
		return 1;
	}
	public int deleteUser(String[] arr) throws SQLException {
		int ii =0;
		String sql="delete from t_user where loginName=?";
		for (String i : arr) {
			 ii = qr.update(sql,i);
			 if(ii<1) {
				return 0;
			 }
		}
		return 1;
	}
	public int deleteScore(String[] arr) throws SQLException {
		int ii =0;
		String sql="delete from t_score where studentNum=?";
		for (String i : arr) {
			 ii = qr.update(sql,i);
			 if(ii<1) {
				return 0;
			 }
		}
		return 1;
	}
}
